<script>
	export default {
		onLaunch: function() {
			let openid=uni.getStorageSync('openid');
			if(!openid){
				this.login()
			}
		},
		onShow: function() {
		},
		onHide: function() {
		},
		methods:{
			login(){
				uni.login({
					provider:'weixin',
					success:async res=> {
						let code=res.code;
						let userinfo=await this.$api('login',{code:code});
						uni.setStorageSync('openid',userinfo.openid)
						uni.setStorageSync('viplevel',userinfo.viplevel)
						
					}
				})
			},
			
		}
		
	}
</script>

<style lang="scss">
	@import '~@/static/styles/app.scss';
</style>
